#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main()
{
    int q;
    cin >> q;
    while(q--)
    {
        int a , b , c;
        cin >> a >> b >> c;
        int res = 0;
        int you =  min(a , min(b , c));
        int o = b - you;
        if(o > 1) res = you * 2 + o - 1;
        else res = you * 2;
        cout << res << endl;
    }
    return 0;
}